package com.attendcollatesys.entity.page;

import java.util.List;

public class PaginationHelper<T> {
    private List<T> dataList;
    private int pageSize;
    private int pageNum;

    public PaginationHelper(List<T> dataList, int pageSize, int pageNum) {
        this.dataList = dataList;
        this.pageSize = pageSize;
        this.pageNum = pageNum;
    }

    public List<T> getPageData() {
        int startIndex = (pageNum - 1) * pageSize;
        int endIndex = Math.min(startIndex + pageSize, dataList.size());
        return dataList.subList(startIndex, endIndex);
    }
}
